//
//	SNKNewsModel.m
//
//	Create by Kavee DJ on 11/12/2016
//	Copyright © 2016. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "SNKNewsModel.h"

NSString *const kSNKNewsModelCategory = @"category";
NSString *const kSNKNewsModelContent = @"content";
NSString *const kSNKNewsModelPic = @"pic";
NSString *const kSNKNewsModelSrc = @"src";
NSString *const kSNKNewsModelTime = @"time";
NSString *const kSNKNewsModelTitle = @"title";
NSString *const kSNKNewsModelUrl = @"url";
NSString *const kSNKNewsModelWeburl = @"weburl";

@interface SNKNewsModel ()
@end
@implementation SNKNewsModel




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kSNKNewsModelCategory] isKindOfClass:[NSNull class]]){
		self.category = dictionary[kSNKNewsModelCategory];
	}	
	if(![dictionary[kSNKNewsModelContent] isKindOfClass:[NSNull class]]){
		self.content = dictionary[kSNKNewsModelContent];
	}	
	if(![dictionary[kSNKNewsModelPic] isKindOfClass:[NSNull class]]){
		self.pic = dictionary[kSNKNewsModelPic];
	}	
	if(![dictionary[kSNKNewsModelSrc] isKindOfClass:[NSNull class]]){
		self.src = dictionary[kSNKNewsModelSrc];
	}	
	if(![dictionary[kSNKNewsModelTime] isKindOfClass:[NSNull class]]){
		self.time = dictionary[kSNKNewsModelTime];
	}	
	if(![dictionary[kSNKNewsModelTitle] isKindOfClass:[NSNull class]]){
		self.title = dictionary[kSNKNewsModelTitle];
	}	
	if(![dictionary[kSNKNewsModelUrl] isKindOfClass:[NSNull class]]){
		self.url = dictionary[kSNKNewsModelUrl];
	}	
	if(![dictionary[kSNKNewsModelWeburl] isKindOfClass:[NSNull class]]){
		self.weburl = dictionary[kSNKNewsModelWeburl];
	}	
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.category != nil){
		dictionary[kSNKNewsModelCategory] = self.category;
	}
	if(self.content != nil){
		dictionary[kSNKNewsModelContent] = self.content;
	}
	if(self.pic != nil){
		dictionary[kSNKNewsModelPic] = self.pic;
	}
	if(self.src != nil){
		dictionary[kSNKNewsModelSrc] = self.src;
	}
	if(self.time != nil){
		dictionary[kSNKNewsModelTime] = self.time;
	}
	if(self.title != nil){
		dictionary[kSNKNewsModelTitle] = self.title;
	}
	if(self.url != nil){
		dictionary[kSNKNewsModelUrl] = self.url;
	}
	if(self.weburl != nil){
		dictionary[kSNKNewsModelWeburl] = self.weburl;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.category != nil){
		[aCoder encodeObject:self.category forKey:kSNKNewsModelCategory];
	}
	if(self.content != nil){
		[aCoder encodeObject:self.content forKey:kSNKNewsModelContent];
	}
	if(self.pic != nil){
		[aCoder encodeObject:self.pic forKey:kSNKNewsModelPic];
	}
	if(self.src != nil){
		[aCoder encodeObject:self.src forKey:kSNKNewsModelSrc];
	}
	if(self.time != nil){
		[aCoder encodeObject:self.time forKey:kSNKNewsModelTime];
	}
	if(self.title != nil){
		[aCoder encodeObject:self.title forKey:kSNKNewsModelTitle];
	}
	if(self.url != nil){
		[aCoder encodeObject:self.url forKey:kSNKNewsModelUrl];
	}
	if(self.weburl != nil){
		[aCoder encodeObject:self.weburl forKey:kSNKNewsModelWeburl];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.category = [aDecoder decodeObjectForKey:kSNKNewsModelCategory];
	self.content = [aDecoder decodeObjectForKey:kSNKNewsModelContent];
	self.pic = [aDecoder decodeObjectForKey:kSNKNewsModelPic];
	self.src = [aDecoder decodeObjectForKey:kSNKNewsModelSrc];
	self.time = [aDecoder decodeObjectForKey:kSNKNewsModelTime];
	self.title = [aDecoder decodeObjectForKey:kSNKNewsModelTitle];
	self.url = [aDecoder decodeObjectForKey:kSNKNewsModelUrl];
	self.weburl = [aDecoder decodeObjectForKey:kSNKNewsModelWeburl];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	SNKNewsModel *copy = [SNKNewsModel new];

	copy.category = [self.category copy];
	copy.content = [self.content copy];
	copy.pic = [self.pic copy];
	copy.src = [self.src copy];
	copy.time = [self.time copy];
	copy.title = [self.title copy];
	copy.url = [self.url copy];
	copy.weburl = [self.weburl copy];

	return copy;
}
@end